package org.example.enmus;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Objects;

@RequiredArgsConstructor
@Getter
public enum LoginTypeEnum {

    ADMIN(1,"admin", "管理系统"),
    USER(2,"user", "用户系统"),
    OPERATION(3,"operation", "运营系统"),
    ;
    
    private final Integer type;
    private final String key;

    private final String desc;

    public static Integer getTypeByKey(String key) {
        for (LoginTypeEnum value : LoginTypeEnum.values()) {
            if (StrUtil.equals(key,value.key)) {
                return value.type;
            }
        }
        return null;
    }
    public static String getKeyByType(Integer type) {
        for (LoginTypeEnum value : LoginTypeEnum.values()) {
            if (Objects.equals(type,value.type)) {
                return value.key;
            }
        }
        return null;
    }
    
    
    }
